/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tpdisenio2009.model.beans;

/**
 *
 * @author Pablito
 */
public class FantasyTeamGlobalScore implements Comparable {

    private FantasyTeam fantasyTeam;
    private int score;

    public FantasyTeamGlobalScore() {
        fantasyTeam = null;
        score = 0;
    }

    public FantasyTeamGlobalScore(FantasyTeam team, int points) {
        fantasyTeam = team;
        score = points;
    }

    public FantasyTeam getFantasyTeam() {
        return fantasyTeam;
    }

    public void setFantasyTeam( FantasyTeam team ) {
        fantasyTeam = team;
    }

    public int getScore() {
        return score;
    }

    public void setScore( int points ) {
        score = points;
    }

    public boolean equals(FantasyTeamGlobalScore ftgs) {
        return ( ftgs.getFantasyTeam().equals( fantasyTeam ) && ftgs.getScore() == score );
    }

    public int compareTo(Object o) {
        FantasyTeamGlobalScore equipo = (FantasyTeamGlobalScore) o;

        if( equipo.getScore() == score ) {
            return 0;
        } else if ( equipo.getScore() > score ) {
            return 1;
        } else {
            return -1;
        }
    }

    @Override
    public String toString() {
        return fantasyTeam.toString();
    }
}